﻿@{
    ViewBag.title = "信息发布";
}

<div id="divNoticeIndex" v-cloak class="content">
    <div class="whiteBackgroundBox">
        <div class="NewContent">
            <h3><span>信息发布</span></h3>
            @* 顶部搜索 *@
            <div class="topbts">
                <div class="searchBox">
                    <em>类型</em>
                    <el-select v-model="search.type" placeholder="请选择" v-on:change="initPageIndex" clearable size="small" style="width: 120px;">
                        <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                    <em>标题</em>
                    <el-input v-model="search.title" v-on:change="initPageIndex" clearable maxlength="20" size="small" style="width:180px;" placeholder="请输入标题"></el-input>
                    <em>发布时间</em>
                    <el-date-picker v-model="search.time" style="width:120px;" type="date" size="small" placeholder="选择日期"></el-date-picker>
                    <el-button type="primary" size="mini" style="margin:0 0 0 5px;" v-on:click="getNewslist">搜索</el-button>
                </div>
                <el-button type="success" v-on:click="addNews" size="mini">发布信息</el-button>
                <div class="clear"></div>
            </div>

            <div class="newList">
                <el-table :data="newsList" style="width: 100%">
                    <el-table-column prop="title" label="标题"></el-table-column>
                    <el-table-column prop="userName" label="发布人" width="150"></el-table-column>
                    <el-table-column label="类型" width="80">
                        <template slot-scope="scope">
                            <span v-if="scope.row.noticeType==1">招考信息</span>
                            <span v-else-if="scope.row.noticeType==2">招考要闻</span>
                            <span v-else-if="scope.row.noticeType==3">教育动态</span>
                            <span v-else>系统公告</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="updateTime" label="日期" width="100" :formatter="formatDate"></el-table-column>
                    <el-table-column label="操作" width="200">
                        <template slot-scope="scope">
                            <el-link type="primary" v-on:click="intoDetail(scope.row.id)" style="margin:0 10px 0 0;">详情</el-link>
                            <el-link type="primary" v-on:click="updateNews(scope.row)" style="margin:0 10px 0 0;">修改</el-link>
                            <el-link type="danger" v-on:click="delNews(scope.row.id)">删除</el-link>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="paging">
                    <el-pagination background layout="prev, pager, next"
                                   v-on:current-change="pageChange"
                                   :current-page="pagination.currentpage"
                                   :total="pagination.total"
                                   :hide-on-single-page="true"></el-pagination>
                </div>
            </div>

        </div>
    </div>

    @* 弹层样式 *@

    <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="60%" v-on:open="udeitorOpen" :before-close="closeDialog" v-bind:close-on-click-modal="false">
        <el-form :model="form" :rules="rules" ref="form" label-width="60px">
            <el-form-item label="类型">
                <el-radio-group v-model="form.noticeType"  >
                    <el-radio :label="1">招考信息</el-radio>
                    <el-radio :label="2">招考要闻</el-radio>
                    <el-radio :label="3">教育动态</el-radio>
                    <el-radio :label="4">系统公告</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="标题" prop="title">
                <el-input v-model="form.title" autocomplete="off" maxlength="50" style="width:450px;" size="small"></el-input>
            </el-form-item>
        </el-form>
        <div id="Content" style="width:100%; height:300px; margin:5px -2px;">
        </div>
        <span slot="footer" class="dialog-footer">
            <el-button v-on:click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" v-on:click="saveNews">确 定</el-button>
        </span>
    </el-dialog>
</div>
@section scripts
    {
    <script src="~/lib/ueditor/ueditor.config.js" asp-append-version="true"></script> 
    <script src="~/lib/ueditor/ueditor.all.js"></script>
    <script src="~/lib/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script src="~/js/modules/notice/index.js" asp-append-version="true"></script>
}